package com.example.myshopping3.model;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 结果处理类
 */
@Getter
public class Result implements Serializable {
    private Result (){}

    public Result(Integer code, String message, boolean success, Object data) {
        this.code = code;
        this.message = message;
        this.success = success;
        this.data = data;
    }

    private Integer code;
    private String message;
    private boolean success;
    private Object data;


    public static Result success(String message,Object data){
        return new Result(200,message,true,data);
    }


    public static Result failt(int code,String message,Object data){
        return new Result(code,message,false,data);
    }
}
